% run_maker.m 4/22/2014 Parker MacCready & Sarah Giddings
%
% driver for the code that creates ROMS forcing files
%
% Uses object-oriented programming.

clear all

% set global paths and directories
addpath('../../alpha/'); Tdir = toolstart;

% set local paths required by some methods
addpath run_definitions run_functions

% add user-specific paths
addpath([Tdir.tools 'rtools_user/runs/run_definitions']);

disp('**********************************')

% store some run-specific information in Tdir
Tdir.cesm_scenario_tag = '45';
Tdir.base_year_str = '2005';
Tdir.base_year = str2num(Tdir.base_year_str);
% these will be available to all methods as part of rn.Tdir


gname = 'scidac'; % defines the grid to use
tag1 = Tdir.cesm_scenario_tag; % indicate which scenario to use ("which_cesm")
tag2 = Tdir.base_year_str; % an additional tag to denote the time interval

% NOTE: for the scidac runs the base year will be the same as the run year,
% but in the future we could separate theses (e.g. always make the base
% year be 1970).

% and this is the actual time interval
if 0 % a full year
    tdlims = [datenum(Tdir.base_year,1,1,0,0,0), ...
        datenum(Tdir.base_year+1,1,1,0,0,0)];
else % testing
    tdlims = [datenum(Tdir.base_year,1,14,0,0,0), ...
        datenum(Tdir.base_year,1,17,0,0,0)];
end

% initial creation of the run object
%
%eval(['rn = ',gname,'_',tag1,';']); % ORIGINAL VERSION
%
% I made one definition to handle all three CESM scenarios
% but we still keep results separate
eval(['rn = ',gname,'_cesm;']);

rn.addInfo(Tdir,gname,tag1,tag2,tdlims);

rn.makeDir;

rn.addGrid;

rn.setScoord;

rn.makeS;

rn.makeClim;

rn.makeAtm;

rn.makeTide;

rn.makeRivers;

rn.addDye;
